
import socket

server = socket.socket()

server.bind(('127.0.0.1',8001))

server.listen()

while 1:
    conn,addr = server.accept()

    from_browers_msg = conn.recv(1024)
    print('from_browers_msg',from_browers_msg.decode('utf-8'))
    send_msg = b'HTTP/1.1 200 ok\r\n\r\n'
    # data = b'<h1>daguangtou</h1>'
    conn.send(send_msg)
    # conn.send(data)
    with open('test01.html','r',encoding='utf-8') as f:
        data = f.read()
    import time
    data = data.replace('{{ name }}',str(time.time()))
    conn.send(data.encode('utf-8'))

    conn.close()







